<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>合併兩個表</title>
<link href="practice.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
	//------------------------------------------------------------------------
	var request_f4 = new createAJAX_f4();

	if (request_f4 == null)
	  alert("無法產生 request 物件:您不能正常使用本網頁");
	
	//依據不同的瀏覽器，取得 XMLHttpRequest 物件
	function createAJAX_f4() {
		try{
			var request_f4 = new XMLHttpRequest();
			return request_f4;
		} catch (erri){
			try{
		        var arrSignatures = ["MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0",
		                             "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP",
		                             "Microsoft.XMLHTTP"];
		        for (var i=0; i < arrSignatures.length; i++) {
		            try {
		                var request_f4 = new ActiveXObject(arrSignatures[i]);
						return request_f4;
		            } catch (oError) {
		                //ignore
		            }
		        }          
			} catch (errii){
		                //ignore
			}
		}
	}
	
	function safe_tags_f4(str) {
	    return "以下為ajax傳回的 HTML 原始碼<p>"+str.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;') ;
	}

	function changeDIV_f4() {
		if (request_f4.readyState == 4) {
			if (request_f4.status == 200 ||request_f4.status == 0) {
				var reqTxt = request_f4.responseText;
				var source = safe_tags_f4(reqTxt);
				document.getElementById("f4").innerHTML = reqTxt;//把source拿掉]
				
				var alertid = document.getElementById("showAlert");
				if(alertid != null){
					alert("刪除成功");
				}
			} else
				alert("f4 Error! Request status is " + request_f4.status);
		}
	}

	function startRunAJAX_f4() {
		request_f4 = new createAJAX_f4();
		request_f4.onreadystatechange = changeDIV_f4;
		request_f4.open("post", "control_f4.jsp", true);
		request_f4.setRequestHeader("Content-Type",
				"application/x-www-form-urlencoded");
		sendAllFormField_f4();
	}

	function sendAllFormField_f4() {
		var sParams = "";
		
		for (i = 0; i < document.form_f4.length; i++) {
			var fName = document.form_f4[i].name;
			var fValue = document.form_f4[i].value;
			if(document.form_f4[i].type == "checkbox"){
				if(document.form_f4[i].checked){
					sParams = addPostParam_f4(sParams, fName, fValue);
				}
			}else if(document.form_f4[i].type == "radio"){
				if(document.form_f4[i].checked){
					sParams = addPostParam_f4(sParams, fName, fValue);
				}
			}else if(document.form_f4[i].type == "image"){
				sParams = addPostParam_f4(sParams, fName, fValue);
			}else{
				sParams = addPostParam_f4(sParams, fName, fValue);
			}
		}
		request_f4.send(sParams);
		return sParams;
	}

	function addPostParam_f4(sParams, sParamName, sParamValue) {
		if (sParams.length > 0) {
			sParams += "&";
		}
		return sParams + encodeURIComponent(sParamName) + "="
				+ encodeURIComponent(sParamValue);
	}

	function topagex_f4(topageNum) {
		document.form_f4.toPage.value = topageNum;
		document.form_f4.nextPage.value = "";
		document.form_f4.pk.value = "";
		document.form_f4.command.value = "";
		startRunAJAX_f4();
	}

	function nextPagex_f4(nextPagex) {
		document.form_f4.nextPage.value = nextPagex;
		document.form_f4.toPage.value = "";
		document.form_f4.pk.value = "";
		document.form_f4.command.value = "";
		startRunAJAX_f4();
	}

	function jsort_f4(fName) {
		document.form_f4.sortName.value = fName;
		document.form_f4.toPage.value = 1;
		document.form_f4.pk.value = "";
		document.form_f4.command.value = "";
		startRunAJAX_f4();
	}
	//----------------------
	function jedit_f4(pk) {
		document.form_f4.pk.value = pk;
		document.form_f4.command.value = "edit";
		startRunAJAX_f4();
	}

	function jdel_f4(pk) {
		var check = confirm("Do you want to delete data ?");
		if (check) {
			document.form_f4.pk.value = pk;
			document.form_f4.command.value = "del";
			startRunAJAX_f4();
		}
	}

	function jyes_f4(pk) {
		document.form_f4.pk.value = pk;
		document.form_f4.command.value = "yes";
		startRunAJAX_f4();
	}

	function jno_f4(pk) {
		document.form_f4.pk.value = pk;
		document.form_f4.command.value = "no";
		startRunAJAX_f4();
	}

	function jotherCommand_f4(pk, commandValue) {
		document.form_f4.pk.value = pk;
		document.form_f4.command.value = commandValue;
		startRunAJAX_f4();
	}
	//************************************
	
	
		//------------------------------------------------------------------------
	var request_f16 = new createAJAX_f16();

	if (request_f16 == null)
	  alert("無法產生 request 物件:您不能正常使用本網頁");
	
	//依據不同的瀏覽器，取得 XMLHttpRequest 物件
	function createAJAX_f16() {
		try{
			var request_f16 = new XMLHttpRequest();
			return request_f16;
		} catch (erri){
			try{
		        var arrSignatures = ["MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0",
		                             "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP",
		                             "Microsoft.XMLHTTP"];
		        for (var i=0; i < arrSignatures.length; i++) {
		            try {
		                var request_f16 = new ActiveXObject(arrSignatures[i]);
						return request_f16;
		            } catch (oError) {
		                //ignore
		            }
		        }          
			} catch (errii){
		                //ignore
			}
		}
	}
	
	function safe_tags_f16(str) {
	    return "以下為ajax傳回的 HTML 原始碼<p>"+str.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;') ;
	}

	function changeDIV_f16() {
		if (request_f16.readyState == 4) {
			if (request_f16.status == 200 ||request_f16.status == 0) {
				var reqTxt = request_f16.responseText;
				var source = safe_tags_f16(reqTxt);
				document.getElementById("f16").innerHTML = reqTxt;
				
				var alertid = document.getElementById("showAlert");
				if(alertid != null){
					alert("刪除成功");
				}
			} else
				alert("f16 Error! Request status is " + request_f16.status);
		}
	}

	function startRunAJAX_f16() {
		request_f16 = new createAJAX_f16();
		request_f16.onreadystatechange = changeDIV_f16;
		request_f16.open("post", "control_f16.jsp", true);
		request_f16.setRequestHeader("Content-Type",
				"application/x-www-form-urlencoded");
		sendAllFormField_f16();
	}

	function sendAllFormField_f16() {
		var sParams = "";
		
		for (i = 0; i < document.form_f16.length; i++) {
			var fName = document.form_f16[i].name;
			var fValue = document.form_f16[i].value;
			if(document.form_f16[i].type == "checkbox"){
				if(document.form_f16[i].checked){
					sParams = addPostParam_f16(sParams, fName, fValue);
				}
			}else if(document.form_f16[i].type == "radio"){
				if(document.form_f16[i].checked){
					sParams = addPostParam_f16(sParams, fName, fValue);
				}
			}else if(document.form_f16[i].type == "image"){
				sParams = addPostParam_f16(sParams, fName, fValue);
			}else{
				sParams = addPostParam_f16(sParams, fName, fValue);
			}
		}
		request_f16.send(sParams);
		return sParams;
	}

	function addPostParam_f16(sParams, sParamName, sParamValue) {
		if (sParams.length > 0) {
			sParams += "&";
		}
		return sParams + encodeURIComponent(sParamName) + "="
				+ encodeURIComponent(sParamValue);
	}

	function topagex_f16(topageNum) {
		document.form_f16.toPage.value = topageNum;
		document.form_f16.nextPage.value = "";
		document.form_f16.pk.value = "";
		document.form_f16.command.value = "";
		startRunAJAX_f16();
	}

	function nextPagex_f16(nextPagex) {
		document.form_f16.nextPage.value = nextPagex;
		document.form_f16.toPage.value = "";
		document.form_f16.pk.value = "";
		document.form_f16.command.value = "";
		startRunAJAX_f16();
	}

	function jsort_f16(fName) {
		document.form_f16.sortName.value = fName;
		document.form_f16.toPage.value = 1;
		document.form_f16.pk.value = "";
		document.form_f16.command.value = "";
		startRunAJAX_f16();
	}
	//----------------------
	function jedit_f16(pk) {
		document.form_f16.pk.value = pk;
		document.form_f16.command.value = "edit";
		startRunAJAX_f16();
	}

	function jdel_f16(pk) {
		var check = confirm("Do you want to delete data ?");
		if (check) {
			document.form_f16.pk.value = pk;
			document.form_f16.command.value = "del";
			startRunAJAX_f16();
		}
	}

	function jyes_f16(pk) {
		document.form_f16.pk.value = pk;
		document.form_f16.command.value = "yes";
		startRunAJAX_f16();
	}

	function jno_f16(pk) {
		document.form_f16.pk.value = pk;
		document.form_f16.command.value = "no";
		startRunAJAX_f16();
	}

	function jotherCommand_f16(pk, commandValue) {
		document.form_f16.pk.value = pk;
		document.form_f16.command.value = commandValue;
		startRunAJAX_f16();
	}
</script>




</head>



<body>

<br>
	<div id="f4">
		<jsp:include page="control_f4.jsp">
			<jsp:param name="jheader"  		value="學生ID,姓名,電話" />
			<jsp:param name="pageSize" 		value="2" />
			<jsp:param name="nowPage"  		value="1" />
			<jsp:param name="toPage"   		value="1" />
			<jsp:param name="number" 		value="on"/>
			<jsp:param name="sortStatus"    value="no,no,no"/>
			<jsp:param name="colSize"       value="3"/>
			<jsp:param name="divId"         value="f4"/>
			<jsp:param name="myQuery"         value="自訂查詢條件"/>
		</jsp:include>
	</div>
	<br>

<hr>
	<br>
	<div id="f16">
		<jsp:include page="control_f16.jsp">
			<jsp:param name="jheader"  		value="分數ID,課程名稱,分數,學生ID" />
			<jsp:param name="pageSize" 		value="3" />
			<jsp:param name="nowPage"  		value="1" />
			<jsp:param name="toPage"   		value="1" />
			<jsp:param name="number" 		value="on"/>
			<jsp:param name="sortStatus"    value="no,no,no,no"/>
			<jsp:param name="colSize"       value="4"/>
			<jsp:param name="divId"         value="f16"/>
			<jsp:param name="myQuery"         value="自訂查詢條件"/>
		</jsp:include>
	</div>
	


</body>
</html>
